package com.project.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.RegionBean;
import com.project.dao.RegionDao;
import com.project.service.RegionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 区域
 */
@Service
@Transactional
public class RegionServiceImpl extends ServiceImpl<RegionDao, RegionBean> implements RegionService {
    @Override
    public IPage<RegionBean> findAllRegion(int pageNO, int pageSize) {
        Page<RegionBean> page = new Page<>(pageNO,pageSize);
        IPage<RegionBean> iPage = this.page(page);
        this.baseMapper.findAllRegion();
        return iPage;
    }

    @Override
    public void addRegion(RegionBean regionBean) {
        this.baseMapper.insert(regionBean);
    }

    @Override
    public IPage<RegionBean> findName(int pageNO, int pageSize, String regionName, String regionForest, String classList) {
        Page<RegionBean> page = new Page<>(pageNO,pageSize);
        IPage<RegionBean> iPage = this.page(page);
        this.baseMapper.findName(regionName,regionForest,classList);
        return iPage;
    }
}
